package es.udc.emarketapp.emarket.model.purchase.purchaseFacade.actions;

import java.sql.Connection;

import es.udc.emarketapp.emarket.model.purchase.dao.SQLPurchaseDAO;
import es.udc.emarketapp.emarket.model.purchase.dao.SQLPurchaseDAOFactory;
import es.udc.fbellas.j2ee.util.exceptions.InstanceNotFoundException;
import es.udc.fbellas.j2ee.util.exceptions.InternalErrorException;
import es.udc.fbellas.j2ee.util.sql.TransactionalPlainAction;


public class UpdatePurchaseValueAction implements TransactionalPlainAction {

    private Long nPurchase;
    private double value;

    public UpdatePurchaseValueAction(Long nPurchase, double value) {
        this.nPurchase = nPurchase;
        this.value = value;
    }
    
    public Object execute(Connection connection) 
        throws InternalErrorException, InstanceNotFoundException {        

        SQLPurchaseDAO purchaseDAO = SQLPurchaseDAOFactory.getDAO();

        purchaseDAO.updateValue(connection, nPurchase, value);
        
        return null;

    }


}

